// var os = require("os");
var osUtils = require("os-utils");

function start() {

    // osUtils.cpuUsage(function (currCPU) {

    // var freeMem = os.freemem() / 1024 / 1024 / 1024;
    // var totalMem = os.totalmem() / 1024 / 1024 / 1024;
    // var data = {
    //     cpuUsage: (currCPU * 100.0).toFixed(2) + "%",
    //     freeMem: freeMem.toFixed(2) + "G",
    //     totalMem: totalMem.toFixed(2) + "G",
    //     usedMem: (totalMem - freeMem).toFixed(2) + "G",
    //     MemUsage: ((totalMem - freeMem) / totalMem * 100.0).toFixed(2) + "%",
    // };
    // console.log(data)

    // });

    console.log({
        platform: osUtils.platform(),
        cpuCount: osUtils.cpuCount(),
        freemem: (osUtils.freemem() / 1024).toFixed(2) + "G",
        totalmem: (osUtils.totalmem() / 1024).toFixed(2) + "G",
        freememPercentage: (osUtils.freememPercentage() * 100).toFixed(2) + '%',
        sysUptime: (osUtils.sysUptime() / 60 / 60 / 24).toFixed(2) + '天',
        processUptime: osUtils.processUptime(),
        allLoadavg: osUtils.allLoadavg(),
        loadavg1: osUtils.loadavg(1).toFixed(2),
        loadavg5: osUtils.loadavg(5).toFixed(2),
        loadavg15: osUtils.loadavg(15).toFixed(2)
    });

}

start();